package one.stand.controller;

import one.stand.model.ResultModel;
import one.stand.request.UserLevelRequest;
import one.stand.response.UserLevelResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 分销管理 （3.2版本迭代）
 *
 * @author: ZRH
 * @CreateDate: 2019/6/20 9:29
 */
@RestController
@RequestMapping("distribution")
public class DistributionController extends BaseController{

    /**
     * 申请成为分销员
     *
     * @param request
     * @return
     */
    @PostMapping("/insertUserLevel")
    public ResultModel<Boolean> insertUserLevel(@RequestBody UserLevelRequest request) {
        return distributionService.insertUserLevel(request);
    }

    /**
     * 分销员中心
     *
     * @param request
     * @return
     */
    @PostMapping("/getUserLevelInfo")
    public ResultModel<Map<String, Object>> getUserLevelInfo(@RequestBody UserLevelRequest request) {
        return distributionService.getUserLevelInfo(request);
    }

    /**
     * 生成邀请卡
     *
     * @param request
     * @return
     */
    @PostMapping("/saveInvitationCard")
    public ResultModel<Map<String, Object>> saveInvitationCard(@RequestBody UserLevelRequest request) {
        return distributionService.saveInvitationCard(request);
    }

    /**
     * 邀请存为分销员(扫码进入)
     *
     * @param request
     * @return
     */
    @PostMapping("/saveDistributor")
    public ResultModel<Boolean> saveDistributor(@RequestBody UserLevelRequest request) {
        return distributionService.saveDistributor(request);
    }

    /**
     * 我的邀请列表
     *
     * @param request
     * @return
     */
    @PostMapping("/myInvitationList")
    public ResultModel<Map<String, Object>> myInvitationList(@RequestBody UserLevelRequest request) {
        return distributionService.myInvitationList(request);
    }

    /**
     * 推广商家列表
     *
     * @param request
     * @return
     */
    @PostMapping("/applyBusinessList")
    public ResultModel<Map<String, Object>> applyBusinessList(@RequestBody UserLevelRequest request) {
        return distributionService.applyBusinessList(request);
    }

    /**
     * 推广订单列表
     *
     * @param request
     * @return
     */
    @PostMapping("/distributorOrderList")
    public ResultModel<List<UserLevelResponse>> distributorOrderList(@RequestBody UserLevelRequest request) {
        return distributionService.distributorOrderList(request);
    }
}
